package com.spring.nio.core.event.listener.event.model;

import com.spring.nio.core.channel.context.SocketChannelContext;
import com.spring.nio.core.event.listener.event.ExceptionEvent;
import com.spring.nio.core.event.listener.event.constant.EventSourceTypeEnum;
import com.spring.nio.core.event.listener.event.constant.ExceptionEventTypeEnum;
import lombok.Data;

/**
 * @author: YSFY
 * @date: 2021-03-24 14:31
 * @pacage_name: com.spring.nio.core.event.listener.event.model
 * @class_name: ExceptionEventSource
 * @description: 异常事件源
 */
@Data
public class ExceptionEventSource implements EventSource {

    /**
     * 产生处理异常的通道上下文
     * */
    private SocketChannelContext socketChannelContext;

    /**
     * 模块名称
     * */
    private String module;

    /**
     * 异常
     * */
    private Exception exception;

    /**
     * 异常事件类型
     * */
    private ExceptionEventTypeEnum exceptionEventTypeEnum;

    /**
     * 产生异常是否发送异常信息到客户端
     * */
    private Boolean isSend;

    @Override
    public EventSourceTypeEnum getEventSourceTypeEnum() {
        return EventSourceTypeEnum.EXCEPTION_EVENT_SOURCE;
    }

    @Override
    public Class getEventClass() {
        return ExceptionEvent.class;
    }
}
